<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MC823 - Laboratório de Redes: Trabalho 01: Referência do Arquivo beejServer.c</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Gerado por Doxygen 1.7.4 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Busca');
--></script>
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">MC823 - Laboratório de Redes: Trabalho 01</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Página&#160;Principal</span></a></li>
      <li><a href="annotated.html"><span>Estruturas&#160;de&#160;Dados</span></a></li>
      <li class="current"><a href="files.html"><span>Arquivos</span></a></li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Busca" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>Lista&#160;de&#160;Arquivos</span></a></li>
      <li><a href="globals.html"><span>Globais</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#define-members">Definições e Macros</a> &#124;
<a href="#func-members">Funções</a>  </div>
  <div class="headertitle">
<div class="title">Referência do Arquivo beejServer.c</div>  </div>
</div>
<div class="contents">
<div class="textblock"><code>#include &lt;stdio.h&gt;</code><br/>
<code>#include &lt;stdlib.h&gt;</code><br/>
<code>#include &lt;unistd.h&gt;</code><br/>
<code>#include &lt;errno.h&gt;</code><br/>
<code>#include &lt;string.h&gt;</code><br/>
<code>#include &lt;sys/types.h&gt;</code><br/>
<code>#include &lt;sys/socket.h&gt;</code><br/>
<code>#include &lt;netinet/in.h&gt;</code><br/>
<code>#include &lt;netdb.h&gt;</code><br/>
<code>#include &lt;arpa/inet.h&gt;</code><br/>
<code>#include &lt;sys/wait.h&gt;</code><br/>
<code>#include &lt;signal.h&gt;</code><br/>
<code>#include &quot;<a class="el" href="resposta_8h_source.html">resposta.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="tempo_8h_source.html">tempo.h</a>&quot;</code><br/>
</div><div class="textblock"><div class="dynheader">
Gráfico de dependência de inclusões para beejServer.c:</div>
<div class="dyncontent">
<div class="center"><img src="beejServer_8c__incl.png" border="0" usemap="#beejServer_8c" alt=""/></div>
<map name="beejServer_8c" id="beejServer_8c">
<area shape="rect" id="node27" href="resposta_8h.html" title="resposta.h" alt="" coords="119,83,209,112"/><area shape="rect" id="node34" href="tempo_8h.html" title="tempo.h" alt="" coords="1239,83,1313,112"/><area shape="rect" id="node29" href="str_8h.html" title="str.h" alt="" coords="123,160,173,189"/></map>
</div>
</div>
<p><a href="beejServer_8c_source.html">Vá para o código-fonte deste arquivo.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="define-members"></a>
Definições e Macros</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="beejServer_8c.html#a614217d263be1fb1a5f76e2ff7be19a2">PORT</a>&#160;&#160;&#160;&quot;39410&quot;</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="beejServer_8c.html#aeefbbafa97642defe3ee6c3080b7d66f">BACKLOG</a>&#160;&#160;&#160;10</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="beejServer_8c.html#a16c16f9369be4a374a3e621f6d13bb16">MAXDATASIZE</a>&#160;&#160;&#160;100</td></tr>
<tr><td colspan="2"><h2><a name="func-members"></a>
Funções</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="beejServer_8c.html#a6c2d9589ac70568b8e3a6980bb3d45d6">sigchld_handler</a> (int s)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="beejServer_8c.html#a294867ba9d7ff47e39d421134d8e12ab">get_in_addr</a> (struct sockaddr *sa)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="beejServer_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
</table>
<hr/><h2>Definições e macros</h2>
<a class="anchor" id="aeefbbafa97642defe3ee6c3080b7d66f"></a><!-- doxytag: member="beejServer.c::BACKLOG" ref="aeefbbafa97642defe3ee6c3080b7d66f" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define BACKLOG&#160;&#160;&#160;10</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definição na linha <a class="el" href="beejServer_8c_source.html#l00022">22</a> do arquivo <a class="el" href="beejServer_8c_source.html">beejServer.c</a>.</p>

</div>
</div>
<a class="anchor" id="a16c16f9369be4a374a3e621f6d13bb16"></a><!-- doxytag: member="beejServer.c::MAXDATASIZE" ref="a16c16f9369be4a374a3e621f6d13bb16" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define MAXDATASIZE&#160;&#160;&#160;100</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definição na linha <a class="el" href="beejServer_8c_source.html#l00023">23</a> do arquivo <a class="el" href="beejServer_8c_source.html">beejServer.c</a>.</p>

</div>
</div>
<a class="anchor" id="a614217d263be1fb1a5f76e2ff7be19a2"></a><!-- doxytag: member="beejServer.c::PORT" ref="a614217d263be1fb1a5f76e2ff7be19a2" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define PORT&#160;&#160;&#160;&quot;39410&quot;</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definição na linha <a class="el" href="beejServer_8c_source.html#l00021">21</a> do arquivo <a class="el" href="beejServer_8c_source.html">beejServer.c</a>.</p>

</div>
</div>
<hr/><h2>Funções</h2>
<a class="anchor" id="a294867ba9d7ff47e39d421134d8e12ab"></a><!-- doxytag: member="beejServer.c::get_in_addr" ref="a294867ba9d7ff47e39d421134d8e12ab" args="(struct sockaddr *sa)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void* get_in_addr </td>
          <td>(</td>
          <td class="paramtype">struct sockaddr *&#160;</td>
          <td class="paramname"><em>sa</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Função que obtem o endereço do socket</p>
<p>sa - estrutura de dados do tipo sockaddr</p>
<p>endereço do socket (IPv4 ou IPv6) </p>

<p>Definição na linha <a class="el" href="beejServer_8c_source.html#l00052">52</a> do arquivo <a class="el" href="beejServer_8c_source.html">beejServer.c</a>.</p>

</div>
</div>
<a class="anchor" id="a840291bc02cba5474a4cb46a9b9566fe"></a><!-- doxytag: member="beejServer.c::main" ref="a840291bc02cba5474a4cb46a9b9566fe" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Função que controla o fluxo de execução do servidor, recebendo os parâmetros passados pelo cliente, montando uma resposta de acordo com esses parâmetros, e devolvendo essa resposta ao cliente</p>
<p>inteiro indicando se o fluxo de execução do programa foi bem sucedido </p>

<p>Definição na linha <a class="el" href="beejServer_8c_source.html#l00072">72</a> do arquivo <a class="el" href="beejServer_8c_source.html">beejServer.c</a>.</p>

<p><div class="dynheader">
Este é o diagrama das funções utilizadas por esta função:</div>
<div class="dyncontent">
<div class="center"><img src="beejServer_8c_a840291bc02cba5474a4cb46a9b9566fe_cgraph.png" border="0" usemap="#beejServer_8c_a840291bc02cba5474a4cb46a9b9566fe_cgraph" alt=""/></div>
<map name="beejServer_8c_a840291bc02cba5474a4cb46a9b9566fe_cgraph" id="beejServer_8c_a840291bc02cba5474a4cb46a9b9566fe_cgraph">
<area shape="rect" id="node3" href="tempo_8c.html#afa8cb739ea2c6f04b660789e2e36e9ee" title="calculaTempo" alt="" coords="121,29,228,59"/><area shape="rect" id="node5" href="beejClient_8c.html#a294867ba9d7ff47e39d421134d8e12ab" title="get_in_addr" alt="" coords="127,83,223,112"/><area shape="rect" id="node7" href="resposta_8c.html#a9bb7e31e6340d62b3afb839655847563" title="preparaResposta" alt="" coords="109,136,240,165"/><area shape="rect" id="node48" href="beejServer_8c.html#a6c2d9589ac70568b8e3a6980bb3d45d6" title="sigchld_handler" alt="" coords="115,189,235,219"/><area shape="rect" id="node9" href="resposta_8c.html#a2b6f397b0bfae5590b292d282513c54b" title="escreveComentario" alt="" coords="288,5,435,35"/><area shape="rect" id="node13" href="resposta_8c.html#a6c04d45a3b24b43c86d50889bde25d67" title="infoDisciplina" alt="" coords="504,104,608,133"/><area shape="rect" id="node31" href="resposta_8c.html#aae0e9c217f1ede36bbf9821b36bba3f9" title="infoDisciplinas" alt="" coords="500,157,612,187"/><area shape="rect" id="node36" href="resposta_8c.html#a2a098bc71f2a19dd74318fd778676979" title="leComentario" alt="" coords="308,109,415,139"/><area shape="rect" id="node39" href="resposta_8c.html#adca402fde30bac4845d32a7dd4e6160a" title="listaDisciplinas" alt="" coords="499,264,613,293"/><area shape="rect" id="node43" href="resposta_8c.html#ae53e5d927eddd073efa7dd3777c222c2" title="programaDisciplina" alt="" coords="484,211,628,240"/><area shape="rect" id="node11" href="resposta_8c.html#aaf2c986b7320373a463f607a67c07365" title="uppercase" alt="" coords="705,104,793,133"/><area shape="rect" id="node15" href="str_8c.html#a9c98046afe58b4d941f546c5a604a7de" title="str_concat_chararr" alt="" coords="679,211,820,240"/><area shape="rect" id="node26" href="str_8c.html#a43e9efab3e78f169462b9f842c827fba" title="str_initialize" alt="" coords="701,157,797,187"/><area shape="rect" id="node17" href="str_8c.html#a47d6c89b7dacac751de1965e2ee90189" title="str_free_size" alt="" coords="871,237,972,267"/><area shape="rect" id="node21" href="str_8c.html#ae20e94ac638a09b2cd12680cbdae2910" title="str_max_size" alt="" coords="1021,289,1128,319"/><area shape="rect" id="node24" href="mm_8c.html#a93a8ec6e8a6eef0f62b7e5b50d0bf9e4" title="xrealloc" alt="" coords="887,184,956,213"/><area shape="rect" id="node19" href="str_8c.html#a0df87a68167272d6191fd0fcef787752" title="str_cur_size" alt="" coords="1025,236,1124,265"/><area shape="rect" id="node28" href="mm_8c.html#a42ccfa6fc49cc4ce90cc44cd05052490" title="xmalloc" alt="" coords="887,131,956,160"/></map>
</div>
</p>

</div>
</div>
<a class="anchor" id="a6c2d9589ac70568b8e3a6980bb3d45d6"></a><!-- doxytag: member="beejServer.c::sigchld_handler" ref="a6c2d9589ac70568b8e3a6980bb3d45d6" args="(int s)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void sigchld_handler </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>s</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Função auxiliar para controlar os processos filhos</p>
<p>s - flag </p>

<p>Definição na linha <a class="el" href="beejServer_8c_source.html#l00036">36</a> do arquivo <a class="el" href="beejServer_8c_source.html">beejServer.c</a>.</p>

<p><div class="dynheader">
Este é o diagrama das funções que utilizam esta função:</div>
<div class="dyncontent">
<div class="center"><img src="beejServer_8c_a6c2d9589ac70568b8e3a6980bb3d45d6_icgraph.png" border="0" usemap="#beejServer_8c_a6c2d9589ac70568b8e3a6980bb3d45d6_icgraph" alt=""/></div>
<map name="beejServer_8c_a6c2d9589ac70568b8e3a6980bb3d45d6_icgraph" id="beejServer_8c_a6c2d9589ac70568b8e3a6980bb3d45d6_icgraph">
<area shape="rect" id="node3" href="beejServer_8c.html#a840291bc02cba5474a4cb46a9b9566fe" title="main" alt="" coords="177,5,231,35"/></map>
</div>
</p>

</div>
</div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>Todos</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Estruturas de Dados</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Arquivos</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Funções</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variáveis</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Definições de Tipos</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Definições e Macros</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address class="footer"><small>Gerado em Quarta, 25 de Abril de 2012 23:42:04 para MC823 - Laboratório de Redes: Trabalho 01 por&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>
